﻿using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace VirusCleaner.Tray
{
    internal partial class ExitBox : Form
    {
        #region 退出类型
        /// <summary>
        /// 退出类型
        /// </summary>
        public enum ExitType
        {
            NONE = 0,
            /// <summary>
            /// 关闭15分钟
            /// </summary>
            MIN15 = 1,
            /// <summary>
            /// <summary>
            /// 关闭1小时
            /// </summary>
            HOUR1 = 2,
            /// <summary>
            /// 关闭3小时
            /// </summary>
            HOUR3 = 3,
            /// <summary>
            /// 关闭8小时
            /// </summary>
            HOUR8 = 4,
            /// <summary>
            /// 完全退出
            /// </summary>
            FULLEXIT = 5
        }
        #endregion
        ExitType result = ExitType.NONE;

        public ExitBox()
        {
            InitializeComponent();
        }
        private void FrmExit_Load(object sender, EventArgs e)
        {
            cmbLevel.SelectedIndex = 0;
        }
        public static new ExitType Show()
        {
            ExitType result;
            using (var dialog = new ExitBox())
            {
                result = dialog.ShowDialog();
            }
            return result;
        }

        /// <summary>
        /// Shows the current form as a dialog box.
        /// </summary>
        /// <returns>The result of the dialog.</returns>
        protected new ExitType ShowDialog()
        {
            base.ShowDialog();
            return this.result;
        }

        private void BtnOkClick(object sender, EventArgs e)
        {
            result = (ExitType)cmbLevel.SelectedIndex + 1;
        }
    }
}
